/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010.

	This file is part of Maxsi Engine.

	Maxsi Engine is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi Engine is distributed in the hope that it will be useful, but WITHOUT
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
	for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	MaxsiEngine.dll
	A general purpose C++ library for the Maxsi Technology Project.

	MaxsiArguments.cpp
	Reusable methods for passing arguments.

******************************************************************************/

#include "MaxsiEngine.h"

BeginMaxsiNamespace

#if 0

List GetArguments(int argc, char** argv)
{
	List Result = 0;
	int I = 0;
	size_t NumVariables = 0;
	
	//char* VariableName = 0;

	for (char K = 0; K < 2; K++)
	{
		for (I = 1; I < argc; I++)
		{
			if ( strlen(argv[I]) > 0 && argv[I][0] == '-')
			{
				if ( K )
				{
					Argument TheArgument;
					TheArgument.ArgumentName = argv[I];
					TheArgument.ArgumentParameter = argv[I+1];
					SetListEntry(Result,(size_t)NumVariables,(BYTE*)&TheArgument,sizeof(Argument));

					NumVariables++;
					I++;
					
				}
				else
				{
					NumVariables++;
					I++;
				}

				//VariableName = argv[I];
			}
		}
		if (!K)
		{
			Result = CreateList(NumVariables);
			NumVariables = 0;
		}
	}

	return Result;
}

char* GetArgumentParameter(List Arguments, char* ArgumentName)
{
	size_t ArgumentArraySize = GetListSize(Arguments);
	Argument* TheArgument;
	for (size_t I = 0; I < ArgumentArraySize; I++)
	{
		TheArgument = (Argument*)GetListEntry(Arguments,(unsigned int)I);
		if (strcmp(TheArgument->ArgumentName,ArgumentName)==0)
		{
			return TheArgument->ArgumentParameter;
		}
	}
	return 0;
}

#endif

EndMaxsiNamespace

